//
//  BIDLoadMoreDataView.m
//  EducationAssistant
//
//  Created by mal on 15/8/27.
//  Copyright (c) 2015年 cnsoft. All rights reserved.
//

#import "BIDLoadMoreDataView.h"

@implementation BIDLoadMoreDataView

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

- (void)setAttachmentPos:(ATTACHMENT_POS)attachmentPos
{
    switch(attachmentPos)
    {
        case POS_UP:
        {
            //调整箭头方向
            [_imgView layer].transform = CATransform3DMakeRotation(M_PI*2, 0.0f, 0.0f, 1.0f);
        }
            break;
        case POS_DOWN:
        {
            [_imgView layer].transform = CATransform3DMakeRotation(M_PI, 0.0f, 0.0f, 1.0f);
        }
            break;
    }
}

- (void)taskIdle
{
    _imgView.hidden = NO;
    _avtivityIndicatorView.hidden = NO;
    [_imgView layer].transform = CATransform3DMakeRotation(M_PI*2, 0.0f, 0.0f, 1.0f);
    NSString *strText = @"";
    switch(_attachmentPos)
    {
        case POS_UP:
        {
            strText = @"上拉加载更多";
        }
            break;
        case POS_DOWN:
        {
            strText = @"下拉加载更多";
        }
            break;
    }
    [_label setText:strText];
}

- (void)taskReady
{
    _avtivityIndicatorView.hidden = NO;
    _imgView.hidden = NO;
    [_imgView layer].transform = CATransform3DMakeRotation(M_PI, 0.0f, 0.0f, 1.0f);
    [_label setText:@"释放开始加载"];
}

- (void)taskStart
{
    _avtivityIndicatorView.hidden = NO;
    _imgView.hidden = YES;
    [_avtivityIndicatorView startAnimating];
    [_label setText:@"加载中..."];
}

- (void)taskEnd
{
    [_avtivityIndicatorView stopAnimating];
}

- (void)hasNoMoreData
{
    _avtivityIndicatorView.hidden = YES;
    _imgView.hidden = YES;
    [_label setText:@"没有更多数据了"];
}

@end
